package com.mdd.admin.controller.competition;

import com.mdd.admin.service.ICompetitionApplyService;
import com.mdd.admin.validate.member.MemberApplyValidate;
import com.mdd.admin.validate.member.MemberExamineValicate;
import com.mdd.admin.vo.competition.CompetitionApplyTeamVo;
import com.mdd.common.core.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/adminapi/competition")
@Api(tags = "报名管理")
public class CompetitionSignController {

    @Resource
    ICompetitionApplyService iCompetitionApplyService;

    @PostMapping("/sign/up")
    public AjaxResult signUp(@RequestBody MemberApplyValidate memberApplyValidate){
        iCompetitionApplyService.signUp(memberApplyValidate);
        return AjaxResult.success();
    }

    @GetMapping("/team")
    public AjaxResult team(@RequestParam("teamNo") String teamNo){
        CompetitionApplyTeamVo team = iCompetitionApplyService.team(teamNo);
        return AjaxResult.success(team);
    }

    @PostMapping("/examine")
    @ApiOperation(value="社团成员认证申请")
    public AjaxResult examine(@Validated @RequestBody MemberExamineValicate valicate){
        iCompetitionApplyService.memberExamine(valicate);
        return AjaxResult.success();
    }
}
